/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJFrame.java
 *
 * Created on 11-nov-2009, 19:25:05
 */

package einescase4;

import java.util.Locale;
import javax.swing.JSpinner;

/**
 *
 * @author Administrador
 */
public class NewJFrame extends javax.swing.JFrame {

    /** Creates new form NewJFrame */
    public NewJFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Finestra principal");

        jLabel1.setText("Nom");
        jPanel1.add(jLabel1);

        jTextField1.setPreferredSize(new java.awt.Dimension(100, 20));
        jPanel1.add(jTextField1);

        jLabel2.setText("Cognoms");
        jPanel1.add(jLabel2);

        jTextField2.setPreferredSize(new java.awt.Dimension(100, 20));
        jPanel1.add(jTextField2);

        jLabel3.setText("Edat");
        jPanel1.add(jLabel3);

        jTextField3.setPreferredSize(new java.awt.Dimension(50, 20));
        jPanel1.add(jTextField3);

        jLabel4.setText("CI");
        jPanel1.add(jLabel4);

        jTextField4.setPreferredSize(new java.awt.Dimension(50, 20));
        jPanel1.add(jTextField4);

        jButton1.setText("Click me");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel1.add(jButton1);

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        NewJDialog dialeg = new NewJDialog(this,true);
        DialogBean bean = new DialogBean();
        dialeg.setBean(bean);
        dialeg.pack();
        dialeg.setVisible(true);
        jTextField1.setText(bean.getNom());
        jTextField2.setText(bean.getCognom());
        jTextField3.setText(bean.getEdat().toString());
        jTextField4.setText(bean.getCI());

    }//GEN-LAST:event_jButton1ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new NewJFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    // End of variables declaration//GEN-END:variables

}
